import {createAsyncThunk} from "@reduxjs/toolkit";
import {PagingData, PagingResult} from "type/Page";
import {SecurityPath} from "type/entity/SecurityPath";
import RequestHandler from "http/RequestHandler";
/** 请求路径的分页数据 */
export const fetchPathPageData = createAsyncThunk(
    'path/fetchPathPageData',
    async (paging: PagingData) => await RequestHandler.get<PagingResult<SecurityPath>>("/manager/admin/path/page/" + paging.page + "/" + paging.pageSize)
);

/** 添加请求路径信息表数据 */
export const fetchAddPath = createAsyncThunk(
    'path/fetchAddPath',
    async (vo: SecurityPath) => {
        return await RequestHandler.put<number>("/manager/admin/path", vo);
    }
);

/** 更新请求路径信息表数据 */
export const fetchUpdatePath = createAsyncThunk(
    'path/fetchUpdatePath',
    async (vo: SecurityPath) => {
        return await RequestHandler.post<number>("/manager/admin/path", vo);
    }
);

